#pragma once


#include"HashTable.h"


namespace XmLife
{
	template <class k, class Hash = HashBucket::HashFunc<k>>

	class  unordered_set
	{
		struct SetKeyOfT
		{
			const k& operator()(const k& key)
			{
				return key;
			}
		};
		
	public:
		typedef typename HashBucket::HashTable<k, k, Hash, SetKeyOfT>::iterator iterator;

		iterator begin()
		{
			return _ht.begin();
		}

		iterator end()
		{
			return _ht.end();
		}

		pair<iterator,bool> insert(const k& key)
		{
			return _ht.insert(key);
		}
		
	private:
		HashBucket::HashTable<k, k, Hash, SetKeyOfT> _ht;
	};

	void test_set()
	{
		unordered_set<int> s;
		s.insert(2);
		s.insert(3);
		s.insert(1);
		s.insert(2);
		s.insert(5);

		//unordered_set<int>::iterator it = s.begin();
		////auto it = s.begin();
		//while (it != s.end())
		//{
		//	cout << *it << " ";
		//	++it;
		//}
		//cout << endl;
	}
}